package com.m;

import java.io.*;

public class CopyFile {
    public static void main(String[] args) {
        if (args.length != 2) {
            System.err.println("You must to give 2 parameters!");
            System.exit(1);
        }
        String source = args[0];
        String copy = args[1];
        try (InputStream input = new FileInputStream(source);
                OutputStream output = new FileOutputStream(copy)) {
            byte[] buffer = new byte[1024];
            int n;
            while ((n = input.read(buffer)) != -1) {
                output.write(buffer, 0, n);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
